{% extends "inner.html" %}
{% block title %}LiveSociety - Mensajes{% endblock %}
{% block content %}
	<form name="page" action="">
		<input type="hidden" name="section" value="Mensajes">
	</form>
		<div id="body_wrapper">
			<div id="body_content_top">
				<div id="middle_box">
					<div id="alertbox">{{ msgbox|default:"" }}</div>
					<div class="rb_title" style="font-size: 15px">Enviar mensaje privado</div>
						<div class="vt_spacer" style="height: 20px;"></div>
						<form id="sendmsg" name="sendmsg" method="post" onSubmit="send_msg(); return false;">
							{% csrf_token %}
							<table>
								<tr>
									<td align="left">
										<b style="font-size: 12px; color: #555;" >Destinatario (Mail)</b>
									</td>
									<td align="left">
										<input type="text" name="friendmail" width="150"/>
									</td>
								</tr>
								
								<tr>
									<td><b style="font-size: 12px;  color: #555;">Contenido</b></td>
								</tr>
								<tr>
									<td colspan="3">
										<textarea type="text" name="msg" style="resize:none; height: 100px; width: 300px; border: none"></textarea>
									</td>
								</tr>
								<tr>
									<td><input type="submit" value="Enviar mensaje"></td>
								</tr>
							</table>
						</form>
						<div class="vt_spacer">
						</div>
						<div class="rb_title" style="font-size: 15px">Bandeja de entrada</div>
							<div class="rb_comment" style="border: none;">
								<table width="600" style="border: 1px dotted orange;">
									<tr>
										<td align="center">
											<b>Autor</b>
										</td>
										<td colspan="1">&nbsp;</td>
										<td align="center">
											<b>Fecha</b>
										</td>
										<td align="right">
											<b>Contenido</b>
										</td>
										<td align="right">
											<b>Estado</b>
										</td>
									</tr>
								</table>
							</div>
							{% for msg in cu_privates %}
								<div class="rb_comment" style="border: none;">
								<table width="600" style="border: 1px dotted orange; border-top: none;" >
									<tr>
										<td align="center"><a href="{{msg.author.id}}"><b style="color: orange;">{{ msg.author }} {{msg.author.lastname}}</b></a></td>
										<td align="center"><b>{{msg.date}} a las {{msg.time}}</b></td>
										<td align="left"><a href="#"><b onClick="read_msg({{ msg.id }});"> Click para leer </b></a></td>
										{% if msg.readed %}
											<td align="right">
												<div id="{{ msg.id }}" class="msg_s">
													<b style="color: green;">Leido</b>
												</div>  
											</td>
										{%else%}
											<td align="right">
												<div id="{{ msg.id }}" class="msg_s">
													<b style="color: red;">No leido</b>
												</div> 
											</td>
										{%endif%}
									</tr>
									<tr>
										<td colspan="4">
											<div id="{{ msg.id }}" class="msg_c">
												<div class="msg_c_close">
													<a href=""><b value='test' onClick="msg_close({{ msg.id }});">X</b></a>
												</div>
												<table width="100%" style="border: 1px solid gray;">
													<tr>
														<td><b>Contenido:</b></td>
													</tr>
													<tr>
														<td align="center">
															<b>{{msg.content}}</b>
														</td>
													</tr>
												</table>
											</div>
										<td>
									</tr>
								</table>
								</div>
							{% empty %}
								<div class="rb_comment">No tienes mensajes entrantes</div>
							{% endfor %}
				</div>
			</div>
		</div>
{% endblock %}
